﻿{template 'header', $module}
<div class="menu">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="tab" id="add"><a href="ask.php?action=add"><span>Submit a new question</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="home"><a href="ask.php"><span>Questions and Answers</span></a></td>
{if $support}
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="support"><a href="support.php"><span>Customer Service Officer</span></a></td>
{/if}
</tr>
</table>
</div>

{if $action == 'add'}
<form method="post" action="ask.php" onsubmit="return check();">
<input type="hidden" name="action" value="{$action}"/>
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl"> <span class="f_red">*</span> Classification</td>
<td class="tr">{$type_select} <span id="dtypeid" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"> <span class="f_red">*</span> Heading</td>
<td class="tr"><input type="text" size="50" name="title" id="title"/> [Limit between 5-30 characters] <span id="dtitle" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"> <span class="f_red">*</span> Content</td>
<td class="tr"><textarea name="content" id="content" class="dsn"></textarea>
{deditor($moduleid, 'content', 'Simple', '98%', 300)}[Limit between 10-5000 characters] <span id="dcontent" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"> </td>
<td class="tr"><input type="submit" name="submit" value=" Determined " class="btn"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value=" Reset " class="btn"/></td>
</tr>
</table>
</form>
<script type="text/javascript">s('ask');m('add');</script>
{elseif $action == 'edit'}
<form method="post" action="ask.php" onsubmit="return check();">
<input type="hidden" name="forward" value="{$forward}"/>
<input type="hidden" name="action" value="{$action}"/>
<input type="hidden" name="itemid" value="{$itemid}"/>
<table cellspacing="1" cellpadding="3" class="tb">
<tr>
<td class="tl"> <span class="f_red">*</span> Classification</td>
<td class="tr">{$type_select} <span id="dtypeid" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"> <span class="f_red">*</span> Heading</td>
<td class="tr"><input type="text" size="50" name="title" id="title" value="{$title}"/> [Limit between 5-30 characters] <span id="dtitle" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"> <span class="f_red">*</span> Content</td>
<td class="tr"><textarea name="content" id="content" class="dsn">{$content}</textarea>
{deditor($moduleid, 'content', 'Simple', '98%', 200)}[Limit between 10-5000 characters] <span id="dcontent" class="f_red"></span></td>
</tr>
<tr>
<td class="tl">&nbsp;</td>
<td class="tr" height="50"><input type="submit" name="submit" value=" Modified " class="btn"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value=" Back " class="btn" onclick="history.back(-1);"/></td>
</tr>
</table>
</form>
<script type="text/javascript">s('ask');m('home');</script>
{elseif $action == 'show'}
<table cellspacing="1" cellpadding="10" class="tb">
<tr>
<td class="tl">Question classification</td>
<td class="tr">{$TYPE[$typeid][typename]}</td>
</tr>
<tr>
<td class="tl">Issue title</td>
<td class="tr f_b">{$title}</td>
</tr>
<tr>
<td class="tl">Issue contents</td>
<td class="tr" style="line-height:180%;">{$content}</td>
</tr>
<tr>
<td class="tl">Submitted</td>
<td class="tr">{$addtime}</td>
</tr>
<tr>
<td class="tl">Call Status</td>
<td class="tr">{$dstatus[$status]}</td>
</tr>
{if $status > 1}
<tr>
<td class="tl">Problem Reply</td>
<td class="tr" style="line-height:180%;background:#FFFFFF;border:#86A2C0 1px dotted;">{$reply}</td>
</tr>
<tr>
<td class="tl">Hours</td>
<td class="tr f_blue">{$admintime}</td>
</tr>
<tr>
<td class="tl">Assignee</td>
<td class="tr">{$admin}</td>
</tr>
<tr>
<td class="tl">My evaluation</td>
<td class="tr">
{if $star}
{$stars[$star]}
{else}
<form method="post" action="ask.php?action=star&itemid={$itemid}">
<input type="radio" name="star" value="1" id="star_1"/><label for="star_1"> Dissatisfied</label>
<input type="radio" name="star" value="2" id="star_2"/><label for="star_2"> Satisfied</label>
<input type="radio" name="star" value="3" id="star_3"/><label for="star_3"> Very satisfied</label>
<input type="submit" name="submit" class="btn" value=" Evaluation "/>
</form>
{/if}
</td>
</tr>
{/if}
</table>
</form>
<script type="text/javascript">s('ask');m('home');</script>
{else}
<div class="ls">
<table cellspacing="0" cellpadding="0" class="tb">
<tr>
<th>Serial number</th>
<th>Status</th>
<th>Title</th>
<th width="150">Add Time</th>
<th>Classification</th>
<th width="60">Modification</th>
<th width="60">Delete</th>
</tr>
{loop $asks $k $v}
<tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center">
<td>&nbsp;{$v[itemid]}&nbsp;</td>
<td>&nbsp;{$v[dstatus]}&nbsp;</td>
<td align="left"><a href="ask.php?action=show&itemid={$v[itemid]}" class="t">{$v[title]}</a></td>
<td>{$v[addtime]}</td>
<td><a href="ask.php?typeid={$v[typeid]}">{$v[type]}</a></td>
<td>
{if $v[status] == 0}<a href="ask.php?action=edit&itemid={$v[itemid]}&forward={urlencode($DT_URL)}"><img width="16" height="16" src="{DT_STATIC}{$MODULE[2][moduledir]}/image/edit.png" title="Modification" alt=""/></a>{else}--{/if}
</td>
<td>
<a href="javascript:confirmURI('Sure you want to delete this? This action shall be irrevocable', 'ask.php?action=delete&itemid={$v[itemid]}&forward={urlencode($DT_URL)}');"><img width="16" height="16" src="{DT_STATIC}{$MODULE[2][moduledir]}/image/delete.png" title="Delete" alt=""/></a>
</td>
</tr>
{/loop}
</table>
</div>
<div class="pages">{$pages}</div>
<script type="text/javascript">s('ask');m('home');</script>
{/if}
{if $action=='add' || $action=='edit'}
<script type="text/javascript">
function check() {
	var len;
	if(Dd('typeid').value == 0) {
		Dmsg('Please select category', 'typeid');
		return false;
	}
	len = Dd('title').value.length;
	if(len < 5 || len > 30) {
		Dmsg('Title can not be less than five words more than 30 characters, the current has been entered '+ len +' characters', 'title');
		return false;
	}
	len = FCKLen();
	if(len < 10 || len > 5000) {
		Dmsg('Content of not less than 10 words more than 5000 words, the current has been entered '+ len +' characters', 'content');
		return false;
	}
	return true;
}
</script>
{/if}
{template 'footer', $module}